﻿using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Linq;
using System;
using HomeBuyerTools.FileStoreService;
using LocalSettings;

namespace HomeBuyerTools
{
    public class AboutUs
    {
        string No = "";

        public List<AboutUsProperties> LoadAboutUsItems()
        {
            List<AboutUsProperties> objList = new List<AboutUsProperties>();
            try
            {
                XDocument xdoc = XDocument.Load("AboutUs/Data.xml");

                var list = from i in xdoc.Descendants("Item") select i;
                foreach (var element in list)
                {
                    AboutUsProperties objItem = new AboutUsProperties();
                    objItem.Id = element.Attribute("Id").Value;

                    if (objItem.Id == "3")
                    {
                        if (IsolatedSettings.getSettingsStringValue("RelatedAppCount") != "")
                            objItem.Name = element.Attribute("Name").Value + " (" + IsolatedSettings.getSettingsStringValue("RelatedAppCount") + ")";
                        else
                            objItem.Name = element.Attribute("Name").Value + " (2)";
                    }
                    else
                        objItem.Name = element.Attribute("Name").Value;
                    objList.Add(objItem);
                }
            }
            catch (Exception ex)
            {
                Exception exNew = new Exception("Exception in LoadAboutUsItems Method In AboutUs file\n\n" + ex.Message + " \n\n Stack Trace \n" + ex.StackTrace);
                throw exNew;
            }

            return objList;
        }
    }
}
